<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 就算promise中的代码时异步的，成功或者失败的回调也会在异步执行完成之后在执行
        let p = new Promise((resolve, reject) => {
            resolve("ok")
        })
        // then方法的回调结果也是一个promise对象，抛出错误，返回结果是非promise对象，返回结果是成功这三种情况
        let result = p.then(value => {console.log(value)},reason => {console.error(reason)})
        
    </script>
</body>
</html>